import java.util.Scanner;

public class Test2 {

    public static void function() throws ArrayIndexOutOfBoundsException {
        int[] arr = {1, 2, 3};
        System.out.println(arr[100]);
    }

    public static void main(String[] args) {
        try {
            function();
        } catch (ArrayIndexOutOfBoundsException e) {

        } finally {

        }

    }
    

    // 下面程序输出什么？
    public static void main2(String[] args) {
        System.out.println(func());
    }

    public static int func() {
        try {
            return 10;
        } finally {
            return 20;
        }
    }


   /* public static int func() {
        try (Scanner scanner = new Scanner(System.in)) {
            return 10;
        } catch (NullPointerException e) {
            System.out.println("捕获到了一个空指针异常！");
        } finally {
            System.out.println("这里执行了finally");
        }
        return 100;
    }
    public static void main1(String[] args) {
        System.out.println(func());
    }*/



    /*public static int func() {
        try {
            int[] array = {1,2,3,4,5,6};
            System.out.println(array.length);
        } catch (NullPointerException e) {
            System.out.println("捕获到了一个空指针异常！");
        } finally {
            System.out.println("这里执行了finally");
        }
        return 10;
    }
    public static void main(String[] args) {
        System.out.println(func());
    }*/

}
